#ifndef OP_GROUP_BY
#define OP_GROUP_BY

#include <cstddef>
#include "Op.h"
#include "OpInput.h"
#include "proto/internal.pb.h"

class OpGroupBy: public Op {
  private:
  	OpInput* source ;
  	char* in ;
  	std::vector<Type> types ;
  	size_t by_column_size, row_size ;
  	
  	bool is_computed_hash_set ;
  	
  	std::vector<char*> rows ;
  	char* next_row, *end_row ;

  public:
	OpGroupBy(const internal::GroupByOperation& operation);

	int doit();
	
  private:
	void allocate_next_rows();
};

#endif
